<template>
  <div class="titleBg">
    <div class="icon">
      <img src="./assets/icon_jiantou.png" alt="">
    </div>
    <span class="text" v-for="(char, index) in titleArray" :style="{ '--delay': index * 0.1 + 's' }">{{
        char
      }}</span>
  </div>
</template>

<script>

export default {
  name: "title",
  data() {
    return {}
  },
  computed: {
    titleArray() {
      return this.title.split('');
    }
  },
  props: {
    title: {
      type: String,
      default() {
        return '';
      }
    }
  },
}
</script>

<style lang="scss" scoped>
.titleBg {
  width: calc(100% - 12px - 10px);
  display: flex;
  margin-left: 12px;
  height: 28px;
  position: relative;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: nowrap;
  flex-direction: row;
  align-content: flex-start;
  background: url("./assets/titlebg.png");
  background-size: 100% 100%;
  margin-top: 15px;

  .icon {
    img {
      width: 18px;
      margin-left: 16px;
      display: flex;
    }
  }

  .text {
    opacity: 0;
    transform: translateY(1em);
    animation: appear 0.5s forwards;
    animation-delay: var(--delay);
    font-size: 18px;
    font-family: YouSheBiaoTiHei;
    font-weight: 400;
    color: #4EC7FF;
    margin-left: 4px;
  }

  @keyframes appear {
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

</style>
